%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% File:               fit_first_step.m
%
% Authors:            Sergio Ascencio and Miguel Rueda
%
% Language:           MATLAB R2013b (8.2.0.701) 64 Bit
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


function results=fit_first_step(X,phats,betas)

betas=reshape(betas,[length(betas)/4,4]);

p_PRI=phats{1,1}(:,1:2); %remember prob H in first, M in second column
p_PAN=phats{1,2}(:,1:2);

psi=best_response(betas,X,phats);

psi_PRI=psi{1,1}(:,1:2);
psi_PAN=psi{1,2}(:,1:2);

results=[psi_PRI(:) p_PRI(:);psi_PAN(:) p_PAN(:)];

labels={'best_response' 'first_step'};
results=dataset({results(:,:) labels{:}});

